<template>
	<view class="" >
		<view class="uni-flex uni-column">
			<view class="flex-item flex-item-V">
				<!-- 轮播图 -->
				<swiper class="screen-swiper" :class="dotStyle?'square-dot':'round-dot'" :indicator-dots="true" :circular="true"
				 :autoplay="true" interval="1500" duration="500" current="0">
					<swiper-item v-for="(item,index) in swiperList" :key="item.ptOrder">
						<image :src="item.ptPath" mode="aspectFill" v-if="item.ptState=='1'"></image>
						<!-- <video :src="item.ptPath" autoplay loop muted :show-play-btn="false" :controls="false" objectFit="cover" v-if="item.type=='video'"></video> -->
					</swiper-item>
				</swiper>
			</view>
			
			<view class="flex-item flex-item-V bg-white " backgroundColor="#fff">
				<view class="uni-flex uni-row" backgroundColor="#fff">
					<view class="" style="width: 33%; margin-left: 50upx; margin-top: 30upx;" >
						<view class="address-right" @click="goAddressList(item.type)" style="width: 120upx;">
							<image class="address-right-img" src="/static/img/活动.png" style="width: 120upx; height: 120upx;" mode=""></image>
							<text class="address-right-text" style="margin-left: 25upx;">活动</text>
						</view>
					</view>
					<view class="" style="width: 33%;margin-top: 30upx;margin-left: 50upx;">
						<view class="address-right" @click="goAddressList(item.type)" style="width: 120upx;">
							<image class="address-right-img" src="/static/img/失物招领.png" style="width: 120upx;height: 120upx;" mode=""></image>
							<text class="address-right-text">失物招领</text>
						</view>
					</view>
					<view class="" style="width: 33%; margin-top: 30upx;margin-left: 60upx;">
						<view class="address-right" @click="goAddressList(item.type)" style="width: 120upx;">
							<image class="address-right-img" src="/static/img/兼职.png" style="width: 120upx;height: 120upx;" mode=""></image>
							<text class="address-right-text" style="margin-left: 28upx;">兼职</text>
						</view>
					</view>
				</view>
			</view>
				
			<view class="flex-item flex-item-V bg-white">
				<!-- 学校新闻标签 -->
				<view class="cu-bar bg-white">
					<view class="action sub-title">
						<text class="text-xl text-bold text-blue">学校新闻</text>
						<text class="text-ABC text-blue">about</text>
						<!-- last-child选择器-->
					</view>
				</view>
				<view class="bg-white na-list" v-for="(item,index) in 10"  :key="index">
					<view class="">
						<view class="na-list-title">
							通知消息
						</view>
						<view class="">
							<text>通知消息通知消息通知消息通知通知消息通知通..</text>
						</view>
						<view style="font-size: 20upx;color: #AAAAAA;">2020.2.2 12:00:00</view>
					</view>
					<view class="">
						<image src="../../static/img/imgTest.png" style="width: 150upx;height: 150upx;border-radius: 4upx;"></image>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>


<script>
	export default {
		data() {
			return {
				user:{
					nickname:'',
					iconUrl:'',
					sex:''
				},
				// 轮播图begin
				swiperList:[],
				dotStyle: true,
				// cardCur: 0,
				// swiperList: [{
				// 	ptPath:"https://ossweb-img.qq.com/images/lol/web201310/skin/big84000.jpg",
				// 	ptOrder:0
				// },
				// {
				// 	ptPath:"https://ossweb-img.qq.com/images/lol/web201310/skin/big39000.jpg",
				// 	ptOrder:1
				// },
				// {
				// 	ptPath:"https://ossweb-img.qq.com/images/lol/web201310/skin/big37006.jpg",
				// 	ptOrder:2
				// },
				// {
				// 	ptPath:"https://ossweb-img.qq.com/images/lol/web201310/skin/big10001.jpg",
				// 	ptOrder:3
				// },
				// {
				// 	ptPath:"https://ossweb-img.qq.com/images/lol/web201310/skin/big25011.jpg",
				// 	ptOrder:4
				// }]
			}
		},
		onLoad() {
			let that = this;
			//轮播图数据
			uni.request({
				url: 'http://localhost:8080/ac_ssm_v5_0_war_exploded/ac/getAllSlideshows',
				method: 'GET',
				data: {},
				success: res => {
					that.swiperList = res.data;
					// console.info(res.data);
				},
				fail: () => {},
				complete: () => {}
			});
			//add、update用户信息
			uni.login({
				success: (open) => {
					getApp().globalData.text = open.code;
					uni.getUserInfo({
						success(result) {
							that.user.iconUrl = result.userInfo.avatarUrl;
							that.user.nickname = result.userInfo.nickName;
							that.user.sex  = result.userInfo.gender;
							uni.setStorage({
								key:'user',
								data:that.user,
								success() {
									console.log("success_update_storage");
								},
								fail() {
									console.log('fail_update_storage');
								}
							});
							uni.request({
								url:getApp().globalData.wx_url+'/ac/addWeChatInfo',
								method:'POST',
								header: { "Content-Type": "application/json" },
								data: {
									"openid": getApp().globalData.text,
									"nickname":result.userInfo.nickName,
									"iconUrl":result.userInfo.avatarUrl,
									"unionid":"",
									"gender":result.userInfo.gender
								},
								success: (back) => {
									console.log(back.data);
								}
							})
						}
					})
				}
			})
		},
		methods: {
			
		},
}
</script>

<style>
	.na-list{
		padding: 25upx;
		display: flex;
	}
	.na-list-title{
		margin-bottom: 10upx;
		font-size: 30upx;
		font-weight: 550;
	}
</style>